﻿<div style="max-width: 400px;">
    <MudForm @ref="_form1" @bind-IsValid="@_valid" @bind-IsTouched="@_touched" ValidationDelay="0" >
        <MudTextField id="textFieldLabelTest" T="string" Label="First Name"/>
        <MudTextField T="string" Required="true" Label="Last Name" />
    </MudForm>
    <div class="d-flex mt-5">
        <MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(() => _form1.Validate())">Validate</MudButton>
        <MudButton Variant="Variant.Filled" Color="Color.Secondary" OnClick="@(() => _form1.ResetAsync())" Class="mx-2">Reset</MudButton>
        <MudButton Variant="Variant.Filled" OnClick="@(() => _form1.ResetValidation())">Reset Validation</MudButton>
    </div>
    <div class="d-flex mt-3">
        <MudSwitch @bind-Value="@_valid" Label="IsValid " Color="Color.Info" />
        <MudSwitch @bind-Value="@_touched" Label="IsTouched" Color="Color.Info" />
    </div>
</div>

@code {
    public static string __description__ = "Form should update the bound variables valid and touched whenever they change.";

    private bool _touched;
    private bool _valid = true;
    private MudForm _form1 = null!;
}
